<p><?php echo $this->description ?></p>

<h3>History</h3>

<table class="dataTable">
	<tr>
		<th>Id</th>
		<th>Author</th>
		<th>Date</th>
		<th>Status</th>
		<th>Description</th>
		<th>Action</th>
	</tr>

<?php
	$currentVersionSeen = false;
	$odd=true;
	foreach($this->actionHistory as $num => $data) {
		//switch odd class between rows
		$oddClass = ($odd)?' class="odd"':'';
		
		echo '<tr'.$oddClass.'>';
		echo '<td><a href="'.$this->baseUrl().'/apidesigner/'.$data['moduleName'].'/'.$data['controllerName'].'/'.$data['actionName'].'/edit/'.$data['id'].'/">'.$data['id'].'</a></td>';
		echo '<td>'.$data['creatorEmail'].'</td>';
		echo '<td>'.date  ( 'd/m/Y H:i' , $data['creationDate']).'</td>';
		
		$status=(!empty($data['status']))?$data['status'].' v'.$data['versionNumber']:'';
		
		echo '<td>'.$status.'</td>';
		echo '<td>'.$data['description'].'</td>';
		
		//Now the actions part
		echo '<td>';
		//If the current version has not already been seen, we can make the version the current one
		if('current' == $data['status']) $currentVersionSeen = true;
		
		if(!$currentVersionSeen) echo '<form action="'.$this->baseUrl().'/apidesigner/index/makemessagecurrent/actionName/'.$data['actionName'].'/controllerName/'.$data['controllerName'].'/moduleName/'.$data['moduleName'].'/id/'.$data['id'].'/" method="GET"><button type="submit">Make current</button></form>';
		
		//Supported ones can be deprecated
		if('supported' == $data['status']) echo '<form action="'.$this->baseUrl().'/apidesigner/index/deprecatemessage/actionName/'.$data['actionName'].'/controllerName/'.$data['controllerName'].'/moduleName/'.$data['moduleName'].'/id/'.$data['id'].'/" method="GET"><button type="submit">Deprecate</button></form>';
		
		echo '</td>'; //end action buttons
		
		echo '</tr>';	
		
		//switch odd class between rows
		$odd=($odd)?false:true;
	}
?>

</table>